package com.moecollege.umiao.ui.navitabs;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.moecollege.moecollegelib.widget.swiperefresh.SwipyRefreshLayout;
import com.moecollege.moecollegelib.widget.swiperefresh.SwipyRefreshLayoutDirection;
import com.moecollege.umiao.R;
import com.moecollege.umiao.frame.UmiaoFragment;
import com.moecollege.umiao.ui.RecyclerViewAdapter;

/**
 * Created by nieyonghui on 15-8-6.
 */
public class VideoFragment extends UmiaoFragment implements SwipyRefreshLayout.OnRefreshListener{
    private RecyclerView mRecyclerView;
    private SwipyRefreshLayout mRefreshLayout;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.index_fragment,container,false);
        mRecyclerView = (RecyclerView) view.findViewById(R.id.index_list);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext()));
        mRecyclerView.setAdapter(new RecyclerViewAdapter(getActivity()));
        mRefreshLayout = (SwipyRefreshLayout) view.findViewById(R.id.index_refresh);
        mRefreshLayout.setColorSchemeColors(new int[]{getResources().getColor(R.color.base)});
        mRefreshLayout.setOnRefreshListener(this);
        return view;
    }

    @Override
    public void onRefresh(SwipyRefreshLayoutDirection direction) {
        mRefreshLayout.setRefreshing(false);
    }
}
